/**
 * 2016，thor.com，all rights reserved。
 * 
 * Project：		palmmall-core
 * Filename：	AMeterValueConverter.java
 * Created：		2016年8月30日
 * Creator：		wolv
 */
package com.thor.palmmall.rest.meter.converter;

import org.springframework.core.convert.converter.Converter;

import com.thor.palmmall.rest.meter.AMeterValue;
import com.thor.palmmall.spi.meter.SMeterValue;

/**
 * @author wolv
 *
 */
public class AMeterValueConverter implements Converter<SMeterValue, AMeterValue> {

	public static AMeterValueConverter getInstance() {
		if (instance == null)
			instance = new AMeterValueConverter();
		return instance;
	}

	private static AMeterValueConverter instance;

	private AMeterValueConverter() {
	}

	@Override
	public AMeterValue convert(SMeterValue source) {
		if (source == null)
			return null;

		AMeterValue target = new AMeterValue();
		target.setCycleCount(source.getCycleCount());
		target.setDate(source.getDate());
		target.setValue(source.getValue());

		return target;
	}

}
